<include file="Public:center_header" />
<script type="text/javascript" src="__STATIC__/pc/js/center.js"></script>
	<div class="content">
		<include file="Public:center_left" />
		<div class="content_right">
			<div class="information">
				<if class="information_img" onmouseenter="chuxian()" onmouseout="close()" onmouseleave="close1()" onclick="add()">
					<div class="information_img_hover">
						修改头像
					</div>
					<if condition="$data.headimage == ''">
						<img src="__STATIC__/pc/img/center2.gif">
						<else/>
						<img src="__STATIC__/uploads/{$data.headimage}">
					</if>
				</div>
				<div class="information_title">
					<div class="information_title_left">基本信息</div>
					<div  class="information_title_right" onclick="edit()" id="">修改</div>
				</div>
				<div class="information_name">
					<span class="color7A7A7A marginright20">用户名</span><span class="color383838 information_val">{$data.username}</span>
					<input class="information_input" type="text" name="username" value="{$data.username}">
				</div>
				<div class="information_phone">
					<span class="color7A7A7A marginright20">手机号</span><span class="color383838 information_val">{$data.mobile}</span>
					<input class="information_input" type="text" name="mobile" value="{$data.mobile}">
				</div>
				<div class="information_sex">
					<span class="color7A7A7A marginright20">性别</span><span class="color383838 information_val information_val"><if condition="$data.sex == '1'">男<else/>女</if></span>
					<span class="information_input1">
						<input type="radio" name="sex" id="male" value="1" <if condition="$data.sex == '1'">checked</if> />
						<label for="male">男</label>
						<input type="radio" name="sex" id="female" value="2" <if condition="$data.sex == '2'">checked</if>/>
						<label for="female">女</label>
					</span>
				</div>
				<div class="information_companyg">
					<span class="color7A7A7A marginright20">公司名</span><span class="color383838 information_val">{$data.company}</span>
					<input class="information_input" type="text" name="company" value="{$data.company}">
				</div>
				<div class="information_password">
					<span class="color7A7A7A marginright20">密码</span><span class="color383838 information_val">**********</span>
					<input class="information_input" type="password" name="passwd" value="{$data.passwd}">
				</div>
			</div>
		</div>
	</div>
	<include file="Public:footer" />
<script>
	var edit = function(){
		if($('.information_title_right').eq(0).text() == '修改'){
			$('.information_title_right').eq(0).attr('id', 'active');
			$('.information_val').css('display','none');
			$('.information_input').css('display','inline-block');
			$('.information_input1').css('display','inline-block');
			$('.information_title_right').eq(0).text('保存');
		}else{
			var formData = new FormData();
			var username = $("input[name='username']").val();
			var mobile = $("input[name='mobile']").val();
			var company = $("input[name='company']").val();
			var passwd = $("input[name='passwd']").val();
			var sex = $("input[name='sex']:checked").val();

			formData.append('username',username);
			formData.append('mobile',mobile);
			formData.append('company',company);
			formData.append('passwd',passwd);
			formData.append('sex',sex);

			$.ajax({
				url:"{:url('Center/edit')}",
				type:'POST',
				data:formData,
				async:false,
				processData:false,
				contentType:false,
				success:function(result){
					if(result.code == '0'){
						layer.alert(result.msg);
					}else{
						layer.alert(result.msg, {
									btn: ['确定']
								},
								function (index, item) {
									location.href = result.url;
								});
					}
				}

			});
//			$('.information_title_right').eq(0).attr('id', '');
//			$('.information_val').css('display','inline-block');
//			$('.information_input').css('display','none');
//			$('.information_input1').css('display','none');
//			$('.information_title_right').eq(0).text('修改');
		}
	}
</script>
</body>
</html>